package com.oa.resources.utils;

/**
 * 文件后缀工具
 * @program: zy-oa-Vue
 * @description: ExtUtil
 * @author: 庄霸.liziye
 * @create: 2022-05-27 16:46
 **/
public class ExtUtil {

    public static final String FILE_DOC = "doc";

    public static final String FILE_DOCX = "docx";

    public static final String FILE_XLS = "xls";

    public static final String FILE_XLSX = "xlsx";

    public static final String FILE_PPT = "ppt";

    public static final String FILE_PPTX = "pptx";

    public static final String FILE_PDF = "pdf";

    public static final String FILE_PNG = "png";

    public static final String FILE_JPG = "jpg";

    public static final String FILE_MP4 = "mp4";


    /**
     * 获取文件对应字典值
     * @param ext
     * @return
     */
    public static String getExtType(String ext)
    {
        switch (ext)
        {
            case FILE_DOC:
            case FILE_DOCX:
                return "1";

            case FILE_XLS:
            case FILE_XLSX:
                return "3";

            case FILE_PPT:
            case FILE_PPTX:
                return "2";

            case FILE_PDF:
                return "4";

            case FILE_PNG:
            case FILE_JPG:
                return "5";

            case FILE_MP4:
                return "6";

            default:
                return "7";
        }
    }
}
